package com.goktech.sportsmall.service.Impl;

import com.goktech.sportsmall.bean.LoginBean;
import com.goktech.sportsmall.bean.UserBean;
import com.goktech.sportsmall.mapper.LoginMapper;
import com.goktech.sportsmall.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {

    @Autowired(required = false)
    private LoginMapper loginMapper;

    @Override
    public String reset(String pwd, int id) {
        int reset = loginMapper.reset(pwd, id);
        if (reset==1){
            return "重置成功";
        }
        return "重置失败";
    }

    // 忘记密码检验
    @Override
    public UserBean forget(String name, String tel) {
        return loginMapper.forget(name,tel);
    }

    // 用户登录[项目]
    @Override
    public UserBean loginUser(String tel, String pwd) {
        return loginMapper.loginUser(tel,pwd);
    }

    // 插入数据[项目]
    @Override
    public int insertUser(LoginBean loginBean) {
        return loginMapper.insertUser(loginBean);
    }

    @Override
    public UserBean userLogin(String account, String password) {
        System.out.println("loginService:"+account+"  "+password);
        return loginMapper.loginByUser(account,password);
    }


}
